﻿using Newtonsoft.Json;

namespace AutomationCommand
{
    public class opcv_option : BasiCommand
    {
        [JsonProperty("fun_type")]
        public string FunType { get; set; }

        [JsonProperty("othername")]
        public string OtherName { get; set; }

        [JsonProperty("m1")]
        public string M1 { get; set; }

        [JsonProperty("m2")]
        public string M2 { get; set; }

        [JsonProperty("s")]
        public double S { get; set; }

        [JsonProperty("swidth")]
        public int SWidth { get; set; }

        [JsonProperty("op")]
        public string Op { get; set; }

        [JsonProperty("swipe")]
        public Swipe Swipe { get; set; }

        [JsonProperty("x")]
        public int X { get; set; }

        [JsonProperty("y")]
        public int Y { get; set; }

        public opcv_option()
        {
            FunType = "opcv_option";
            OtherName = "智能操作";
            M1 = "";
            M2 = "";
            S = 0.95;
            SWidth = 0;
            Op = "";
            Swipe = new Swipe { X = 100, Y = 100, Time = 1500, Speed = 50 };
            X = 0;
            Y = 0;
            SuccessJump = -1;
            FailureJump = -1;
        }

        public bool Execute()
        {
            // 在这里编写执行命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }
    }

    public class Swipe
    {
        [JsonProperty("x")]
        public int X { get; set; }

        [JsonProperty("y")]
        public int Y { get; set; }

        [JsonProperty("time")]
        public int Time { get; set; }

        [JsonProperty("speed")]
        public int Speed { get; set; }
    }
}
